package subumbo.micro.controller
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.system.ApplicationDomain;
	import flash.media.Sound;

	/**
	 * @author patrickwolleb@hotmail.com
	 */
	public class ClassExtractor {
		public static function extractSprite( id : String, applicationDomain : ApplicationDomain = null ) : Sprite {
			if (applicationDomain == null) applicationDomain = ApplicationDomain.currentDomain;
			
			var Item : Class = ApplicationDomain.currentDomain.getDefinition(id) as Class;
	
			return new Item() as Sprite;
		}

		public static function extractMC( id : String, applicationDomain : ApplicationDomain = null ) : MovieClip {
			if (applicationDomain == null) applicationDomain = ApplicationDomain.currentDomain;
			
			var Item : Class = ApplicationDomain.currentDomain.getDefinition(id) as Class;
			
			return new Item() as MovieClip;
		}
		
		public static function extractSound( id : String, applicationDomain : ApplicationDomain = null ) : Sound {
			if (applicationDomain == null) applicationDomain = ApplicationDomain.currentDomain;
			
			var Item : Class = ApplicationDomain.currentDomain.getDefinition(id) as Class;
			
			return new Item() as Sound;
		}
	}
}
